Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2Platformconf = require("Platformconf");
var i = window.qg;
var def_BannerBoxAd = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    this.bannerBoxAd = null;
  }
  return babel_createClass(_ctor, [{
    key: "loadBannerBoxAd",
    value: function loadBannerBoxAd() {
      if (i.getSystemInfoSync().platformVersionCode >= 1076 && null == this.bannerBoxAd) {
        this.bannerBoxAd = i.createGameBannerAd({
          adUnitId: $2Platformconf.default.Instance.getconfig().OPPOGame.boxbanner
        });
        this.bannerBoxAd.onError(function (e) {
          console.log(e);
        });
        this.bannerBoxAd.onLoad(function () {
          console.log("互推盒子横幅广告加载成功");
        });
      }
    }
  }, {
    key: "showBannerBoxAd",
    value: function showBannerBoxAd(e) {
      if (this.bannerBoxAd) {
        if (e) {
          for (var _t in e) {
            this.addStyle(_t, e[_t]);
          }
        }
        this.bannerBoxAd.show().then(function () {
          console.log("promise 回调：展示成功");
        }).catch(function (e) {
          console.log("promise 回调：展示失败 ".concat(JSON.stringify(e)));
        });
      }
    }
  }, {
    key: "hideBannerBoxAd",
    value: function hideBannerBoxAd() {
      this.bannerBoxAd && this.bannerBoxAd.hide().then(function () {
        console.log("hide success");
      }).catch(function (e) {
        console.log("hide fail with:" + e.errCode + "," + e.errMsg);
      });
    }
  }, {
    key: "destroyBannerBoxAd",
    value: function destroyBannerBoxAd() {
      if (this.bannerBoxAd) {
        this.bannerBoxAd.offError();
        this.bannerBoxAd.offLoad();
        this.bannerBoxAd.destroy();
        this.bannerBoxAd = null;
      }
    }
  }, {
    key: "addStyle",
    value: function addStyle(e, t) {
      if (0 !== t && !t || "" === t) {
        return this.bannerBoxAd.style;
      } else {
        return this.bannerBoxAd.style[e] = t, this.bannerBoxAd.style;
      }
    }
  }], [{
    key: "getInstance",
    value: function getInstance() {
      _ctor._instance || (_ctor._instance = new _ctor());
      return _ctor._instance;
    }
  }]);
}();
exports.default = def_BannerBoxAd;
def_BannerBoxAd._instance = null;